package com.bvblogic.android.activities;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.bvblogic.android.R;
import com.bvblogic.android.fragments.PromosListFragment;
import com.bvblogic.android.fragments.CustomFragmentStatePagerAdapter;
import com.bvblogic.android.fragments.RestaurantsListFragment;
import com.viewpagerindicator.TitlePageIndicator;

public class HomeTabActivity extends FragmentActivity {

	private ViewPager viewPager;
    private CustomFragmentStatePagerAdapter fragmentPagerAdapter;
    private Resources res;

	
	@Override
	protected void onCreate(Bundle arg0) {
		// TODO Auto-generated method stub
		super.onCreate(arg0);
		setContentView(R.layout.viewpager_layout);
		Log.v("TV", "HomeTabActivity onCreate");
		res = getResources();
		viewPager = (ViewPager) findViewById(R.id.pager);
		
		fragmentPagerAdapter = new CustomFragmentStatePagerAdapter(getSupportFragmentManager());
		fragmentPagerAdapter.add(new PromosListFragment(), res.getString(R.string.actions));
		fragmentPagerAdapter.add(new RestaurantsListFragment(), res.getString(R.string.restaurants));
		
        viewPager.setAdapter(fragmentPagerAdapter);
        viewPager.setCurrentItem(0);
        viewPager.setOffscreenPageLimit(5);

        TitlePageIndicator titleIndicator = (TitlePageIndicator)findViewById(R.id.titles);
        titleIndicator.setFooterIndicatorHeight(0);
        titleIndicator.setFooterLineHeight(0);
        titleIndicator.setViewPager(viewPager);
        
	}

}
